<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>对象的扩展</title>
</head>
<body>
    <script>
        // 属性名是函数的简写
        let obj = {
            name1:'atguigu',
            say:function(){
                console.log('i can say' + this.name1);
            },
            // 函数简写
            hello(){
                console.log('hello h5220331'+ this.name1);
            },
            test:()=>{
                console.log('arrow ' + this.name1);
            }
        }
        obj.say();
        obj.hello();
        obj.test();

        console.log(NaN === NaN);
        console.log(Object.is(NaN,NaN));
        console.log(Object.is(1,'1'));

        // Object.assign 对象合并

        let obj1 = {sex:'女'};

        let obj2 = {
            name:'李潇成',
            age:18,
            sex:'男',
            say(){
                console.log(this.name);
            }
        }
        let obj4 = {
            city:'杭州'
        }

        let obj3 = Object.assign(obj1,obj2,obj4);

    //    res =  Object.defineProperties(obj,{
    //     })
        console.log(obj3,obj1, obj1 === obj3);
        console.log('obj2',obj2);
        console.log('obj4',obj4);


        // 利用Object.assign 浅拷贝一个对象
        let obj5 = {};
        let obj6 = {name:'付飞阳',age:20};

        Object.assign(obj5,obj6);
        console.log(obj5,obj6,obj5===obj6);

        
    </script>
</body>
</html>